<?php
/**
 * 微信推送消息.
 * User: lvshuyun
 * Date: 2015/6/11
 * Time: 10:24
 */

use kartik\grid\GridView;
use yii\helpers\Html;

$this->title = '自动回复';

$gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'key',
    'reply',
    [
        'attribute' => 'createTime',
        'format' => 'raw',
        'value' => function($model) {
            return date("Y-m-d H:i:s",$model['createTime']);
        },
    ],
    [
        'attribute' => 'adminID',
        'format' => 'raw',
        'value' => 'admin.realName',
    ],
    [
        'class' => 'common\widgets\KartikActionColumn',
        'items' => [
            ['修改', 'auto-reply/edit', 'btn-primary'],
            ['删除', 'auto-reply/del', 'btn-primary'],
        ]
    ]
];

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'toolbar'=> [
        ['content' => Html::a('<i class="glyphicon glyphicon-plus"></i> 添加自动回复', ['auto-reply/add'], ['class' => 'btn btn-primary'])],
        '{toggleData}',
    ],
    'panel' => [
        'type' => GridView::TYPE_DEFAULT,
        'heading' => $this->title,
    ],
    'columns' => $gridColumns,
]);
